 

cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Replication\Log files\Appendix Tables"
clear
log using TableA3.txt, text replace 
 
**Table A3: First and second stage results with alternative return instruments 
***********************************

clear all
cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Data"
use LPSU_MainSample_Sep2024, replace
set matsize 10000
cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Tables"

***Set of fixed effects
egen sic1year=group(sic1 year)
qui tabulate sic1year, generate(dsic1year)
egen month_post= group(month post)
qui tabulate month_post, generate(dmonth)
qui tabulate year_around_ipo, generate(deventyear) 

***Setting the sample to the IV sample (dropping colinear variables with FEs)
set more off
qui xtivreg2 wroa (IPO=instrument) deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth* , fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
gen sample_IV=e(sample) 
keep if sample_IV==1
bysort id: egen count=count(year)
drop if count==1

eststo clear 

**First stages (Columns 1-4)
set more off
eststo: qui xtreg IPO instrument_60_30 deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
test instrument_60_30
outreg2 using Table_FS_app, keep(IPO instrument instrument_60_30 instrument_90_60) sortvar(IPO instrument instrument_60_30 instrument_90_60) tex(frag) word bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)  addstat("F test model", r(F))  replace
 
set more off
eststo: qui xtreg IPO instrument_90_60 deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
test instrument_90_60
outreg2 using Table_FS_app, keep(IPO instrument instrument_60_30 instrument_90_60) sortvar(IPO instrument instrument_60_30 instrument_90_60) tex(frag) word bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)  addstat("F test model", r(F))  
 
set more off
eststo: qui xtreg IPO instrument instrument_60_30 deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
test instrument instrument_60_30
outreg2 using Table_FS_app, keep(IPO instrument instrument_60_30 instrument_90_60) sortvar(IPO instrument instrument_60_30 instrument_90_60) tex(frag) word bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)  addstat("F test model", r(F))   
 
set more off
eststo: qui xtreg IPO instrument instrument_60_30 instrument_90_60 deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe cluster(id) 
test instrument instrument_60_30 instrument_90_60
outreg2 using Table_FS_app, keep(IPO instrument instrument_60_30 instrument_90_60) sortvar(IPO instrument instrument_60_30 instrument_90_60) tex(frag) word bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, First stage)  addstat("F test model", r(F))    
 
esttab,   keep(instrument instrument_60_30 instrument_90_60) order(IPO instrument instrument_60_30 instrument_90_60) label se b(%9.3f) se(%9.3f) r2 star(* 0.1 ** 0.05 *** 0.01) addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes) 
 
eststo clear  
 
 
***Second stages (Columns 5-6)
set more off
eststo: qui xtivreg2 wroa (IPO=instrument instrument_60_30) deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_FS_app, keep(IPO instrument instrument_60_30 instrument_90_60) sortvar(IPO instrument instrument_60_30 instrument_90_60)  tex(frag) word bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes,  IPO month x Post FE, Yes,Regression, Second stage, Instruments, Pos returns>0 60-30 days)  
 
set more off
eststo: qui xtivreg2 wroa (IPO=instrument instrument_60_30 instrument_90_60) deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*, fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_FS_app, keep(IPO instrument instrument_60_30 instrument_90_60) sortvar(IPO instrument instrument_60_30 instrument_90_60) tex(frag) word bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes,  IPO month x Post FE, Yes,Regression, Second stage, Instruments, Pos returns>0 90-60-30 days) 
 
esttab,   keep(IPO) order(IPO) label se b(%9.3f) se(%9.3f) nor2 star(* 0.1 ** 0.05 *** 0.01) addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes) 

 
cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Replication\Log files\Appendix Tables"
log close     
 
 
 